import request from '@/utils/request'

// 获取歌单列表 - 酷我音乐
// https://www.kuwo.cn/search/searchMusicBykeyWord?vipver=1&client=kt&ft=music&cluster=0&strategy=2012&encoding=utf8&rformat=json&mobi=1&issubtitle=1&show_copyright_off=1&pn=0&rn=20&all=%E5%91%A8%E6%9D%B0%E4%BC%A6
export const getKWMusicListService = (item) => {
  const params = {
    vipver: '1',
    client: 'kt',
    ft: 'music',
    cluster: '0',
    strategy: '2012',
    encoding: 'utf8',
    rformat: 'json',
    mobi: '1',
    issubtitle: '1',
    show_copyright_off: '1',
    ...item // pn=0&rn=20&all=
  }
  // return request.get('https://www.kuwo.cn/search/searchMusicBykeyWord', {
  return request.get('kwapi/search/searchMusicBykeyWord', {
    params
  })
}

// 获取音乐源 - 酷我音乐
export const getKWMusicService = (rid) =>
  // request.get(`http://www.xintuo1.cn/music/kw/${rid}`)
  request.get(`xtapi/music/kw/${rid}`)

// 获取音乐源 - 网易云音乐 http://www.xintuo1.cn/music/wyy?msg=十年长沙&n=1
export const getWYYMusicService = (item) => {
  const params = {
    n: item.rid,
    msg: item.msg
  }
  // return request.get('http://www.xintuo1.cn/music/wyy', {
  return request.get('xtapi/music/wyy', {
    params
  })
}
